package com.codeoss.framework.view.renderer;

import org.springframework.stereotype.Service;

import com.codeoss.framework.context.YunContext;
import com.codeoss.framework.view.component.Component;
import com.codeoss.framework.view.component.TreePath;

@Service("treepathRenderer")
public class TreePathRenderer extends CommonComponentRenderer{
	protected void startRenderView(YunContext yunContext, Component component, ViewSerializeMap viewSerializeMap) {
		super.startRenderView(yunContext, component, viewSerializeMap);
		TreePath treePath=(TreePath)component;
		if(treePath.getOnItemClickExpression()!=null) {
			viewSerializeMap.put("onItemClick", true);
		}else {
			viewSerializeMap.put("onItemClick", false);
		}
	}
	@Override
	protected PropSerializeMap startRenderProp(YunContext yunContext, Component component, ViewPropMap viewPropMap) {
		PropSerializeMap propSerializeMap = super.startRenderProp(yunContext, component, viewPropMap);
		Object value=yunContext.getAttribute(component.getId()+"_value");
		if(value!=null) {
			propSerializeMap.put("value", value);
		}
		return propSerializeMap;
	}
}
